package com.ubing.boot.notesforjava.test.json;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @ClassName : test
 * @Description : test
 * @Author : Xxxxx
 * @Date: 2023-05-26 16:35
 */
public class test {

    public static AtomicInteger a = new AtomicInteger(0);
    public static void main(String[] args) throws InterruptedException {
        new Thread(() -> {
            while (true){
                a.getAndIncrement();
                try {
                    Thread.sleep(1000);
                    System.out.println(a.get());
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        }).start();


        new Thread(()->{
            try {
                Thread.sleep(5000);
                test.a.set(0);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }).start();

//        Thread.sleep(10000);

    }

}
